package main

import (
	"fmt"
	"os"

	"github.com/spf13/cobra"
	"github.com/yourusername/lvm-manager/cmd/lvm-cli/commands"
)

var apiURL string

func main() {
	rootCmd := &cobra.Command{
		Use:   "lvm-cli",
		Short: "LVM Manager CLI - Manage libvirt virtual machines",
		Long:  `A command-line interface for managing libvirt virtual machines through LVM Manager daemon.`,
	}

	rootCmd.PersistentFlags().StringVarP(&apiURL, "api", "a", "http://localhost:8080", "API server URL")

	// 添加子命令（不再传 client）
	rootCmd.AddCommand(commands.DomainCommands())
	rootCmd.AddCommand(commands.SnapshotCommands())
	rootCmd.AddCommand(commands.StorageCommands())
	rootCmd.AddCommand(commands.NetworkCommands())
	rootCmd.AddCommand(commands.VersionCmd())

	if err := rootCmd.Execute(); err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
}
